<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Agp\CoreBundle\Manager;

use Doctrine\ORM\EntityManager;
use Agp\CoreBundle\Entity\Ambiente;
use Agp\CoreBundle\Manager\BaseManager;

/**use Agp\CoreBundle\Manager\BaseManager;
 * Description of AmbienteManager
 *
 * @author bondcs
 */
class AmbienteManager extends BaseManager
{
    public function persist($entity) {
        parent::persist($entity);
        
        $manager = $this->container->get('agp.lista.manager');
        foreach ($entity->getSetores() as $s){
            $s->setAmbienteForGrupo($entity->getCodAmbiente());
            $manager->updateNoFlush($s);
        }
        
        $manager->flush();
    }

}

?>
